-- 读取文件
local file = io.open("README.md",'r')
io.input(file)
local txt = io.read()
print(txt)
io.close(file)

-- 追加文件内容
file = io.open("README.md",'a')
io.output(file)
io.write('-- append sth....\n')
io.close(file)

-- 第二种API
local f = io.open("README.md",'r')
local txt = f:read('*l')
print(txt)
f:close()

--IO基础
f = io.open("tmp.txt","w")
if f ~= nil then
	f:write("--haha")
	f:write(string.char(10))
	f:write("print(\"haha\")")
	io.close(f)
	print("file end",os.date())
end

dofile("tmp.txt")
